package com.bw.controller;


import com.bw.entity.*;
import com.bw.mapper.OrderInfoMapper;
import com.bw.mapper.StudentMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.spring.kun.common.ExcelUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
public class StudentController {


    @Autowired
    OrderInfoMapper orderInfoMapper;

    @Autowired
    StudentMapper studentMapper;

    @RequestMapping("/stulist.do")
    public String list(Model model) {

       List<Student> list =  studentMapper.studentList();
        model.addAttribute("list",list);
        return "stuList";
    }

    @RequestMapping("/excelList.do")
    public void excelUser(HttpServletResponse response){

        List<Student> list =  studentMapper.studentList();

        ExcelUtils.exportExcel(list,"学生列表导出","sheet1",response);
    }
    @RequestMapping("/excelCityNum.do")
    public void excelCityNum(HttpServletResponse response){

        List<StudentNum> list =  studentMapper.excelCityNum();

        ExcelUtils.exportExcel(list,"学生城市数量导出","sheet1",response);
    }
}
